home *** CD-ROM | disk | FTP | other *** search
/ Amiga Tools 3 / Amiga Tools 3.iso / grafik / raytracing / rayshade-4.0.6.3 / libray / libcommon / color.h next >
Encoding:
C/C++ Source or Header  |  1994-08-09  |  1.5 KB  |  61 lines

  1. /*
  2.  * color.h
  3.  *
  4.  * Copyright (C) 1989, 1991, Craig E. Kolb
  5.  * All rights reserved.
  6.  *
  7.  * This software may be freely copied, modified, and redistributed
  8.  * provided that this copyright notice is preserved on all copies.
  9.  *
  10.  * You may not distribute this software, in whole or in part, as part of
  11.  * any commercial product without the express consent of the authors.
  12.  *
  13.  * There is no warranty or other guarantee of fitness of this software
  14.  * for any purpose.  It is provided solely "as is".
  15.  *
  16.  * color.h,v 4.1 1994/08/09 07:54:40 explorer Exp
  17.  *
  18.  * color.h,v
  19.  * Revision 4.1  1994/08/09  07:54:40  explorer
  20.  * Bump version to 4.1
  21.  *
  22.  * Revision 1.1.1.1  1994/08/08  04:52:00  explorer
  23.  * Initial import.  This is a prerelease of 4.0.6enh3, or 4.1 possibly.
  24.  *
  25.  * Revision 4.0.1.1  91/09/29  15:32:09  cek
  26.  * patch1: Fixed #endif typo.
  27.  * 
  28.  * Revision 4.0  91/07/17  14:30:08  kolb
  29.  * Initial version.
  30.  * 
  31.  */
  32. #ifndef COLOR_H
  33. #define COLOR_H
  34. /*
  35.  * Color
  36.  */
  37. typedef struct Color {
  38.     Float r, g, b;            /* Red, green, blue. */
  39. } Color;
  40.  
  41. #define ColorScale(s,c,a)        (a)->r = (s)*(c).r, \
  42.                     (a)->g = (s)*(c).g, \
  43.                     (a)->b = (s)*(c).b
  44.  
  45. #define ColorAddScaled(x, s, y, c)    (c)->r = (x).r + (s)*(y).r, \
  46.                     (c)->g = (x).g + (s)*(y).g, \
  47.                     (c)->b = (x).b + (s)*(y).b
  48.  
  49. #define ColorMultiply(x,y,a)        (a)->r = (x).r*(y).r, \
  50.                     (a)->g = (x).g*(y).g, \
  51.                     (a)->b = (x).b*(y).b
  52.  
  53. #define ColorAdd(x,y,a)            (a)->r = (x).r+(y).r, \
  54.                     (a)->g = (x).g+(y).g, \
  55.                     (a)->b = (x).b+(y).b
  56.  
  57. #define ColorInitValue(c, a)        (a)->r = c, \
  58.                     (a)->g = c, \
  59.                     (a)->b = c
  60. #endif /* COLOR_H */
  61.